﻿using System;
using System.IO;
using System.Threading.Tasks;
using log4net;
using ILog = Sample.Helper.ILog;

namespace NetworkSerialPort.Helper
{
    /// <summary>
    /// 日志
    /// </summary>
    public class LogInfo : ILog
    {

        private readonly log4net.ILog _logger;
        public LogInfo(string filePath, string name)
        {
            FileInfo configFile = new FileInfo(filePath);
            log4net.Config.XmlConfigurator.Configure(configFile);
            _logger = LogManager.GetLogger(name);
        }
        public void Debug(object message)
        {
            // _logger.Debug(message);
            //await Task.Run(() =>
            //{
            _logger.Debug(message);
            //});
        }
        public void Error(object message)
        {
            //   _logger.Error(message);
            //await Task.Run(() =>
            //{
            _logger.Error(message);
            //});
        }

        public void Info(string title, string message)
        {
            //await Task.Run(() =>
            //{
            _logger.Info(title + " " + message);
            //});
        }




    }
}
